import React from 'react';
import Icon from '@/components/icon/Icon';
import { string,func } from 'prop-types'
import { ListStyle } from './styledList';
const List = (props) => {
    const {
        title,
        value,
        icon,
        color,
        date,
        unit,
        click
    }=props;
    return (
        <ListStyle onClick={click}>
            <div className='icon'><Icon name={icon} size=".38rem" bgColor={color} color='#FFF' type='large' padding='.14rem'></Icon></div>
            
            <div className='content'>
                <div className="left">
                    <h2 className='title'>{title}</h2>
                    <p className='date'>{date}</p>
                </div>
                <div className="right">
                    <p className="title">{value}<span>{unit}</span></p>
                </div>
            </div>
        </ListStyle>
    );
}

export default List;
List.propTypes={
    title:string,//标题
    icon:string,//图标名字
    color:string,//图标背景颜色
    value:string,//当前值
    date: string,//时间戳
    unit:string,//单位
    // level:number,//结果的表现，正常为0 偏高为1 偏低为-1 
    click:func//点击函数
}
